Class symantec.itools.awt.util.ProgressBar
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.util.ProgressBar

Object
   |
   +----Component
           |
           +----Canvas
                   |
                   +----symantec.itools.awt.util.ProgressBar

public class ProgressBar
extends Canvas
implements BevelStyle, AlignStyle
ProgressBar component. Creates a bar that displays a percentage. Commonly used to indicate the percentage completed of a lengthy task.

Version:
1.1, August 26, 1997
Author:
Symantec

Variable Index

 o INDENT_ONE
Border Indent constant INDENT_ONE.
 o INDENT_TWO
Border Indent constant INDENT_TWO.
 o INDENT_ZERO
Border Indent constant INDENT_ZERO.
 o align
The value of the Alignment Style property.
 o bDrawBoxes
The value of the Draw Boxes property.
 o bShowProgress
The value of the Show Progress property.
 o bevelDarkerColor
The color to use as a hilight when BevelStyle is BEVEL_RAISED or BEVEL_LOWERED.
 o bevelLighterColor
The color to use as a hilight when BevelStyle is BEVEL_RAISED or BEVEL_LOWERED.
 o borderColor
The value of the Border Color property.
 o boxWidth
The value of the Box Width property.
 o bufferImage
The offscreen buffer to draw the button in.
 o cachedBackground
Cached value of the background color.
 o gapWidth
The value of the Gap Width property.
 o indent
The value of the Border Indent property.
 o progress
The value of the Progress Percent property.
 o progressColor
The value of the Progress Bar Color property.
 o type
The value of the Bevel Style property.

Constructor Index

 o symantec.itools.awt.util.ProgressBar()
Constructs a progress bar with a centered progress %, line border and zero indentation.
 o symantec.itools.awt.util.ProgressBar(int, int, int)
Constructs a progress bar with the style and indentation variables specified.

Method Index

 o addBoxWidthListener(PropertyChangeListener)
Adds a listener for the BoxWidth property changes.
 o addBoxWidthListener(VetoableChangeListener)
Adds a vetoable listener for the BoxWidth property changes.
 o addGapWidthListener(PropertyChangeListener)
Adds a listener for the GapWidth property changes.
 o addGapWidthListener(VetoableChangeListener)
Adds a vetoable listener for the GapWidth property changes.
 o addNotify()
Tells this component that it has been added to a container.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener for all event changes.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a vetoable listener for all event changes.
 o calculateHilightColors(Color)
Used to calculate the hilight colors from the background color.
 o getAlignStyle()
Get the current style of the progress bar's alignment
 o getBevelStyle()
Get the current style of the progress bar's border
 o getBorderColor()
Get the color for the border of BEVEL_LINE style ProgressBar.
 o getBorderIndent()
Get the border indent amount.
 o getBorderedColor()
 o getBoxWidth()
Get the width of the boxes drawn for the progress bar.
 o getDrawBoxes()
 o getGapWidth()
Get the gap width of the boxes drawn for the progress bar.
 o getMinimumSize()
Returns the minimum dimensions to properly display this component.
 o getPreferredSize()
Returns the recommended dimensions to properly display this component.
 o getProgressBarColor()
Get the color that the progress bar will be drawing in.
 o getProgressBarTextColor()
 o getProgressPercent()
Get the current percentage complete.
 o getShowProgress()
 o getValue()
Get the current percentage complete.
 o isBufferImageInvalid()
Returns true if a buffer image has been set, but it is not the size of this component.
 o isDrawBoxes()
Get the boolean that controls the drawing of the progress bar as a series of boxes.
 o isShowProgress()
Get the boolean that controls the display of the progress number as a percentage.
 o isValidBoxWidth(int)
Is the given box width valid for this component.
 o isValidGapWidth(int)
Is the given gap width valid for this component.
 o minimumSize()
 o paint(Graphics)
Paints this component using the given graphics context.
 o preferredSize()
 o removeBoxWidthListener(PropertyChangeListener)
Removes a listener for the BoxWidth property changes.
 o removeBoxWidthListener(VetoableChangeListener)
Removes a vetoable listener for the BoxWidth property changes.
 o removeGapWidthListener(PropertyChangeListener)
Removes a listener for the GapWidth property changes.
 o removeGapWidthListener(VetoableChangeListener)
Removes a vetoable listener for the GapWidth property changes.
 o removeNotify()
Tells this component that it is being removed from a container.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a listener for all event changes.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable listener for all event changes.
 o setAlignStyle(int)
Set the style of the progress bar's alignment.
 o setBevelStyle(int)
Set the style of the progress bar's border.
 o setBorderColor(Color)
Set the color for the border of BEVEL_LINE style ProgressBar.
 o setBorderIndent(int)
Set the border indent amount.
 o setBorderIndent(int, boolean)
Set the border indent amount and optionally repaint.
 o setBorderedColor(Color)
 o setBoxWidth(int)
Set the width of the boxes drawn for the progress bar.
 o setDrawBoxes(boolean)
Set the boolean that controls the drawing of the progress bar as a series of boxes.
 o setGapWidth(int)
Set the gap width between boxes drawn for the progress bar.
 o setProgressBarColor(Color)
Set the color that the progress bar will be drawn in.
 o setProgressBarTextColor(Color)
 o setProgressPercent(int)
Set the percentage complete for the process being tracked.
 o setShowProgress(boolean)
Set the boolean that controls the display of the progress number as an percentage.
 o setValue(int)
Set the current percentage complete.
 o update(Graphics)
Handles redrawing of this component on the screen.
 o updateBufferImage()
Maintains the bufferImage size and draws the button in the bufferImage offscreen image.
 o updateProgress(int)

Variables

 o INDENT_ONE
public static final int INDENT_ONE
Border Indent constant INDENT_ONE.

 o INDENT_TWO
public static final int INDENT_TWO
Border Indent constant INDENT_TWO.

 o INDENT_ZERO
public static final int INDENT_ZERO
Border Indent constant INDENT_ZERO.

 o align
protected int align
The value of the Alignment Style property.

 o bDrawBoxes
protected boolean bDrawBoxes
The value of the Draw Boxes property.

 o bShowProgress
protected boolean bShowProgress
The value of the Show Progress property.

 o bevelDarkerColor
protected java.awt.Color bevelDarkerColor
The color to use as a hilight when BevelStyle is BEVEL_RAISED or BEVEL_LOWERED.

 o bevelLighterColor
protected java.awt.Color bevelLighterColor
The color to use as a hilight when BevelStyle is BEVEL_RAISED or BEVEL_LOWERED.

 o borderColor
protected java.awt.Color borderColor
The value of the Border Color property.

 o boxWidth
protected int boxWidth
The value of the Box Width property.

 o bufferImage
protected transient java.awt.Image bufferImage
The offscreen buffer to draw the button in.

 o cachedBackground
protected java.awt.Color cachedBackground
Cached value of the background color. Used to determine if calculated colors need to be updated.

 o gapWidth
protected int gapWidth
The value of the Gap Width property.

 o indent
protected int indent
The value of the Border Indent property.

 o progress
protected int progress
The value of the Progress Percent property.

 o progressColor
protected java.awt.Color progressColor
The value of the Progress Bar Color property.

 o type
protected int type
The value of the Bevel Style property.

Constructors

 o ProgressBar
public ProgressBar()
Constructs a progress bar with a centered progress %, line border and zero indentation.

 o ProgressBar
public ProgressBar(int align,
                   int bevel,
                   int indent)
Constructs a progress bar with the style and indentation variables specified. The default parameters are the border color and progress % color as black, the progress bar color as blue.

Parameters:
align - progress bar alignment style
bevel - progress bar bevel style
indent - border indent INDENT_ZERO, INDENT_ONE, or INDENT_TWO

Methods

 o addBoxWidthListener
public synchronized void addBoxWidthListener(PropertyChangeListener listener)
Adds a listener for the BoxWidth property changes.

Parameters:
listener - the listener to add.
See Also:
removeBoxWidthListener(java.beans.PropertyChangeListener)
 o addBoxWidthListener
public synchronized void addBoxWidthListener(VetoableChangeListener listener)
Adds a vetoable listener for the BoxWidth property changes.

Parameters:
listener - the listener to add.
See Also:
removeBoxWidthListener(java.beans.VetoableChangeListener)
 o addGapWidthListener
public synchronized void addGapWidthListener(PropertyChangeListener listener)
Adds a listener for the GapWidth property changes.

Parameters:
listener - the listener to add.
See Also:
removeGapWidthListener(java.beans.PropertyChangeListener)
 o addGapWidthListener
public synchronized void addGapWidthListener(VetoableChangeListener listener)
Adds a vetoable listener for the GapWidth property changes.

Parameters:
listener - the listener to add.
See Also:
removeGapWidthListener(java.beans.VetoableChangeListener)
 o addNotify
public synchronized void addNotify()
Tells this component that it has been added to a container. This is a standard Java AWT method which gets called by the AWT when this component is added to a container. Typically, it is used to create this component's peer. It has been overridden here to hook-up event listeners.

Overrides:
addNotify in class Canvas
See Also:
removeNotify
 o addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all event changes.

Parameters:
PropertyChangeListener - listener the listener to add.
See Also:
removePropertyChangeListener
 o addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable listener for all event changes.

Parameters:
VetoableChangeListener - listener the listener to add.
See Also:
removeVetoableChangeListener
 o calculateHilightColors
protected void calculateHilightColors(Color c)
Used to calculate the hilight colors from the background color.

See Also:
paint
 o getAlignStyle
public int getAlignStyle()
Get the current style of the progress bar's alignment

Returns:
int the style numeric value indicating progress bar's alignment
See Also:
setAlignStyle
 o getBevelStyle
public int getBevelStyle()
Get the current style of the progress bar's border

Returns:
int the style numeric value indicating progress bar's border, such as BEVEL_LOWERED
See Also:
setBevelStyle
 o getBorderColor
public java.awt.Color getBorderColor()
Get the color for the border of BEVEL_LINE style ProgressBar. This will not be used for other styles.

Returns:
Color that the border will be drawn in.
See Also:
setBorderColor
 o getBorderIndent
public int getBorderIndent()
Get the border indent amount. The default value is INDENT_ZERO.

Returns:
int INDENT_ZERO, INDENT_ONE or INDENT_TWO
See Also:
setBorderIndent
 o getBorderedColor
public java.awt.Color getBorderedColor()
Note: getBorderedColor() is deprecated.

See Also:
getBorderColor
 o getBoxWidth
public int getBoxWidth()
Get the width of the boxes drawn for the progress bar. The default value is 8 pixels.

Returns:
int the pixel width of the boxes in the progress bar.
See Also:
setBoxWidth
 o getDrawBoxes
public boolean getDrawBoxes()
Note: getDrawBoxes() is deprecated.

See Also:
isDrawBoxes()
 o getGapWidth
public int getGapWidth()
Get the gap width of the boxes drawn for the progress bar. The default value is 2 pixels.

Returns:
i the pixel width of the gap between boxes in the progress bar.
See Also:
setBoxWidth, setGapWidth
 o getMinimumSize
public java.awt.Dimension getMinimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Overrides:
getMinimumSize in class Component
See Also:
getPreferredSize
 o getPreferredSize
public java.awt.Dimension getPreferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Overrides:
getPreferredSize in class Component
See Also:
getMinimumSize
 o getProgressBarColor
public java.awt.Color getProgressBarColor()
Get the color that the progress bar will be drawing in. The default color is blue.

Returns:
Color that the Progress Bar will be drawn in.
See Also:
setProgressBarColor
 o getProgressBarTextColor
public java.awt.Color getProgressBarTextColor()
Note: getProgressBarTextColor() is deprecated.

See Also:
getForeground()
 o getProgressPercent
public int getProgressPercent()
Get the current percentage complete.

Returns:
int - current percentage complete
See Also:
setProgressPercent
 o getShowProgress
public boolean getShowProgress()
Note: getShowProgress() is deprecated.

See Also:
isShowProgress
 o getValue
public int getValue()
Get the current percentage complete.

Returns:
int - current percentage complete
See Also:
setValue
 o isBufferImageInvalid
protected boolean isBufferImageInvalid()
Returns true if a buffer image has been set, but it is not the size of this component.

 o isDrawBoxes
public boolean isDrawBoxes()
Get the boolean that controls the drawing of the progress bar as a series of boxes. The default value is false.

Returns:
boolean indicating if the bar should be composed of multiple boxes.
See Also:
setDrawBoxes
 o isShowProgress
public boolean isShowProgress()
Get the boolean that controls the display of the progress number as a percentage. The default value is true

Returns:
boolean indicating if the number should be displayed.
See Also:
setShowProgress
 o isValidBoxWidth
protected boolean isValidBoxWidth(int i)
Is the given box width valid for this component.

Parameters:
i - the given box width
Returns:
true if the given box width is acceptable, false if not.
 o isValidGapWidth
protected boolean isValidGapWidth(int i)
Is the given gap width valid for this component.

Parameters:
i - the given gap width
Returns:
true if the given gap width is acceptable, false if not.
 o minimumSize
public java.awt.Dimension minimumSize()
Note: minimumSize() is deprecated.

Overrides:
minimumSize in class Component
See Also:
getMinimumSize
 o paint
public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Canvas
See Also:
repaint, update
 o preferredSize
public java.awt.Dimension preferredSize()
Note: preferredSize() is deprecated.

Overrides:
preferredSize in class Component
See Also:
getPreferredSize
 o removeBoxWidthListener
public synchronized void removeBoxWidthListener(PropertyChangeListener listener)
Removes a listener for the BoxWidth property changes.

Parameters:
listener - the listener to remove.
See Also:
addBoxWidthListener(java.beans.PropertyChangeListener)
 o removeBoxWidthListener
public synchronized void removeBoxWidthListener(VetoableChangeListener listener)
Removes a vetoable listener for the BoxWidth property changes.

Parameters:
listener - the listener to remove.
See Also:
addBoxWidthListener(java.beans.VetoableChangeListener)
 o removeGapWidthListener
public synchronized void removeGapWidthListener(PropertyChangeListener listener)
Removes a listener for the GapWidth property changes.

Parameters:
listener - the listener to remove.
See Also:
addGapWidthListener(java.beans.PropertyChangeListener)
 o removeGapWidthListener
public synchronized void removeGapWidthListener(VetoableChangeListener listener)
Removes a vetoable listener for the GapWidth property changes.

Parameters:
listener - the listener to remove.
See Also:
addGapWidthListener(java.beans.VetoableChangeListener)
 o removeNotify
public synchronized void removeNotify()
Tells this component that it is being removed from a container. This is a standard Java AWT method which gets called by the AWT when this component is removed from a container. Typically, it is used to destroy the peers of this component and all its subcomponents. It has been overridden here to unhook event listeners.

Overrides:
removeNotify in class Component
See Also:
addNotify
 o removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all event changes.

Parameters:
PropertyChangeListener - listener the listener to remove.
See Also:
addPropertyChangeListener
 o removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable listener for all event changes.

Parameters:
VetoableChangeListener - listener the listener to remove.
See Also:
addVetoableChangeListener
 o setAlignStyle
public void setAlignStyle(int style) throws PropertyVetoException
Set the style of the progress bar's alignment.

Parameters:
style - numeric value indicating the progress bar's alignment
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getAlignStyle
 o setBevelStyle
public void setBevelStyle(int style) throws PropertyVetoException
Set the style of the progress bar's border.

Parameters:
style - numeric value indicating the progress bar's style
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getBevelStyle
 o setBorderColor
public void setBorderColor(Color color) throws PropertyVetoException
Set the color for the border of BEVEL_LINE style ProgressBar. This will not be used for other styles.

Parameters:
color - color that the border will be drawn in.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getBorderColor
 o setBorderIndent
public void setBorderIndent(int indent) throws PropertyVetoException
Set the border indent amount.

Parameters:
indent - INDENT_ZERO, INDENT_ONE or INDENT_TWO
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getBorderIndent, setBorderIndent(int, boolean)
 o setBorderIndent
protected void setBorderIndent(int indent,
                               boolean bRepaint) throws PropertyVetoException
Set the border indent amount and optionally repaint.

Parameters:
indent - INDENT_ZERO, INDENT_ONE or INDENT_TWO
bRepaint - if true, causes a repaint to occur.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getBorderIndent, setBorderIndent(int)
 o setBorderedColor
public void setBorderedColor(Color color) throws PropertyVetoException
Note: setBorderedColor() is deprecated.

Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
setBorderColor
 o setBoxWidth
public void setBoxWidth(int i) throws PropertyVetoException
Set the width of the boxes drawn for the progress bar.

Parameters:
i - the pixel width of the boxes in the progress bar.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getBoxWidth
 o setDrawBoxes
public void setDrawBoxes(boolean b) throws PropertyVetoException
Set the boolean that controls the drawing of the progress bar as a series of boxes.

Parameters:
b - indicating if the bar should be composed of multiple boxes.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getDrawBoxes
 o setGapWidth
public void setGapWidth(int i) throws PropertyVetoException
Set the gap width between boxes drawn for the progress bar.

Parameters:
i - the pixel width of the boxes in the progress bar.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getBoxWidth, getGapWidth
 o setProgressBarColor
public void setProgressBarColor(Color c) throws PropertyVetoException
Set the color that the progress bar will be drawn in.

Parameters:
color - the color that the progress bar will be drawn in.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getProgressBarColor
 o setProgressBarTextColor
public void setProgressBarTextColor(Color c) throws PropertyVetoException
Note: setProgressBarTextColor() is deprecated.

Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
setForeground
 o setProgressPercent
public void setProgressPercent(int p) throws PropertyVetoException
Set the percentage complete for the process being tracked.

Parameters:
p - percentage complete as an integer
Throws: PropertyVetoException
if the specified property value is unacceptable
 o setShowProgress
public void setShowProgress(boolean b) throws PropertyVetoException
Set the boolean that controls the display of the progress number as an percentage.

Parameters:
b - indicating if the progress percentage should be displayed.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getShowProgress
 o setValue
public void setValue(int p) throws PropertyVetoException
Set the current percentage complete.

Parameters:
p - percentage complete
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getValue
 o update
public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to reduce flicker by eliminating the uneeded clearing of the background.

Parameters:
g - the graphics context
Overrides:
update in class Component
See Also:
repaint, paint
 o updateBufferImage
protected void updateBufferImage()
Maintains the bufferImage size and draws the button in the bufferImage offscreen image.

See Also:
paint
 o updateProgress
public void updateProgress(int p) throws PropertyVetoException
Note: updateProgress() is deprecated.

Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
setProgressPercent

All Packages  Class Hierarchy  This Package  Previous  Next  Index